package com.edu.demo.controller;

import com.edu.demo.generator.CodeGenerator;
import com.edu.demo.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 代码生成接口
 */
@Api(tags = "代码生产接口(前端不要动！！！)")
@RestController
@RequestMapping("/generator")
public class GeneratorController {

    @Autowired
    private CodeGenerator codeGenerator;

    @ApiOperation(value = "生成代码接口")
    @PostMapping("/generateCode")
    public Result generateCode(String tableName,boolean noController){
        codeGenerator.generator(tableName,noController);
        return Result.success().msg("代码生成成功");
    }
}
